<?php

class dataprovider {

    private $connection;
    private $databaseName = "servey_database";
    private $serverAdress = "localhost";
    private $user = "root";
    private $pass = "";
    
    public static function ConnectDatabase()
    {
        $connection = mysql_connect($serverAdress, $user);
        if(!$connection)
            return FALSE;
        $state = mysql_select_db($databaseName,$connection);
        if(!$state)
            return FALSE;
        return TRUE;
    }
    public static function ExecuteQuery($sql)
    {
        $connection = mysql_connect($serverAdress, $user,$pass) or die("Connect to localhost fail!");
        mysql_select_db($databaseName,$connection);
        mysql_query("set_names 'utf8'");
        $result = mysql_query($sql,$connection);
        mysql_close($connection);
        return $result;
    }
    public static function CloseDatabase()
    {
        mysql_close($this->connection);
    }
}

?>
